package com.msh.starter.captcha.config;

import com.msh.starter.captcha.enums.CaptchaArithmeticEnum;
import com.msh.starter.captcha.enums.CaptchaCharEnum;
import com.msh.starter.captcha.enums.CaptchaFontEnum;
import com.msh.starter.captcha.enums.CaptchaGenTypeEnum;
import com.msh.starter.captcha.enums.CaptchaStyleEnum;
import lombok.Data;

@Data
public class CaptchaProperties {
  private CaptchaImgProperties img;
  private CaptchaGenProperties gen;


  public CaptchaProperties(){
    this.img = new CaptchaImgProperties();
    this.gen = new CaptchaGenProperties();
  }

  @Data
  public class CaptchaImgProperties{
    /**
     * 验证码字体
     */
    private CaptchaFontEnum font;
    /**
     * 字体大小
     */
    private float fontSize;
    /**
     * 验证码图片默认宽度
     */
    private int width;
    /**
     * 验证码图片默认高度
     */
    private int height;
    /**
     * 样式
     */
    private CaptchaStyleEnum style;

    public CaptchaImgProperties() {
      this.font = CaptchaFontEnum.DEFAULT;
      this.fontSize = 32f;
      this.width = 160;
      this.height = 50;
      this.style = CaptchaStyleEnum.STATIC;
    }

  }

  @Data
  public class CaptchaGenProperties{
    /**
     * 验证码字符默认长度
     */
    private Integer length;
    private CaptchaGenTypeEnum type;
    private CaptchaCharEnum captchaChar;
    private CaptchaArithmeticEnum captchaArithmetic;


    public CaptchaGenProperties() {
      this.length = 4;
      this.type = CaptchaGenTypeEnum.RANDOM_CHAR;
      this.captchaChar = CaptchaCharEnum.NUMBER;
    }
  }
}
